﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;

namespace Luka;

/// <summary>
/// Jwt验证提供器
/// </summary>
public interface IJwtBearerHandler
{
    /// <summary>
    /// 授权处理
    /// </summary>
    Task<bool> AuthorizeHandle(AuthorizationHandlerContext context, HttpContext httpContext);

    /// <summary>
    /// 授权失败处理
    /// </summary>
    Task<object> AuthorizeFailHandle(AuthorizationHandlerContext context, HttpContext httpContext, Exception exception);

    /// <summary>
    /// 权限判断处理
    /// </summary>
    Task<bool> PermissionHandle(AuthorizationHandlerContext context, IAuthorizationRequirement requirement,
        HttpContext httpContext);

    /// <summary>
    /// 权限判断失败处理
    /// </summary>
    Task<object> PermissionFailHandle(AuthorizationHandlerContext context, IAuthorizationRequirement requirement, HttpContext httpContext, Exception exception);
}